#ifndef __SINGLETON_H__
#define __SINGLETON_H__

template
	<
	typename T,
class ThreadingModel = SingleThreaded<T>,
class CreatePolicy = OperatorNew<T>,
class LifeTimePolicy = ObjectLifeTime<T>
	>
class Singleton
{
public:
	static T& Instance();

protected:
	Singleton() {};

private:

	// Prohibited actions...this does not prevent hijacking.
	Singleton(const Singleton &);
	Singleton& operator=(const Singleton &);

	// Singleton Helpers
	static void DestroySingleton();

	// data structure
	typedef typename ThreadingModel::Lock Guard;
	static T *si_instance;
	static bool si_destroyed;
};
#endif